--- nmap-6.40.org/ncat/Makefile.in
+++ nmap-6.40/ncat/Makefile.in
@@ -114,7 +114,7 @@
 
 
 $(TARGET): @LUA_DEPENDS@ $(OBJS) $(NSOCKLIB)
-	$(CC) -o $@ $(CFLAGS) $(lua_cflags) $(LDFLAGS) $(OBJS) $(NSOCKLIB) $(NBASELIB) $(OPENSSL_LIBS) $(PCAP_LIBS) $(LUA_LIBS) $(LIBS)
+	$(CC) -o $@ $(CFLAGS) $(lua_cflags) $(OBJS) $(NSOCKLIB) $(NBASELIB) $(OPENSSL_LIBS) $(PCAP_LIBS) $(LUA_LIBS) $(LIBS) $(LDFLAGS)
 
 %.o: %.c
 	$(CC) $(CPPFLAGS) $(LUA_CFLAGS) $(CFLAGS) -c $< -o $@
--- nmap-6.40.org/Makefile.in
+++ nmap-6.40/Makefile.in
@@ -117,7 +117,7 @@
 $(TARGET): @LUA_DEPENDS@ @LIBLINEAR_DEPENDS@ @PCAP_DEPENDS@ @PCRE_DEPENDS@ @DNET_DEPENDS@ $(NBASEDIR)/libnbase.a $(NSOCKDIR)/src/libnsock.a libnetutil/libnetutil.a $(OBJS)
 	@echo Compiling nmap
 	rm -f $@
-	$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
+	$(CXX) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
 
 build-%: %/Makefile
 	cd $* && $(MAKE)
--- nmap-6.40.org/nping/Makefile.in
+++ nmap-6.40/nping/Makefile.in
@@ -85,7 +85,7 @@
 $(TARGET): $(NBASEDIR)/libnbase.a $(NSOCKDIR)/src/libnsock.a ../libnetutil/libnetutil.a $(OBJS)
 	@echo Compiling nping
 	rm -f $@
-	$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
+	$(CXX) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
 	@echo Nping compiled successfully!
 
 
